package com.example.demo.config;

import io.milvus.client.MilvusServiceClient;
import io.milvus.param.ConnectParam;
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MivusConfig {
    @Value("${milvus.host}")
    private String host;

    @Value("${milvus.port}")
    private int port;
    @Bean
    public MilvusServiceClient milvusServiceClient(){
        //构建连接参数
        ConnectParam connectParam = ConnectParam.newBuilder()
                .withHost(host)
                .withPort(port)
                .build();
        //创建客户端实例
        MilvusServiceClient client = new MilvusServiceClient(connectParam);
        return client;
    }
}
